package cn.iocoder.yudao.module.mini.dal.mysql.comment;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mini.dal.dataobject.comment.CommentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mini.controller.admin.comment.vo.*;

/**
 * 评论 Mapper
 *
 * @author dzy
 */
@Mapper
public interface CommentMapper extends BaseMapperX<CommentDO> {

    default PageResult<CommentDO> selectPage(CommentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommentDO>()
                .eqIfPresent(CommentDO::getTechnicianId, reqVO.getTechnicianId())
                .eqIfPresent(CommentDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(CommentDO::getHomeEconomicsScore, reqVO.getHomeEconomicsScore())
                .eqIfPresent(CommentDO::getHomeEconomicsContent, reqVO.getHomeEconomicsContent())
                .eqIfPresent(CommentDO::getTechnicianScore, reqVO.getTechnicianScore())
                .eqIfPresent(CommentDO::getStoreAttitude, reqVO.getStoreAttitude())
                .eqIfPresent(CommentDO::getTechnicianAttitude, reqVO.getTechnicianAttitude())
                .betweenIfPresent(CommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommentDO::getId));
    }

    default List<CommentDO> selectList(CommentExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CommentDO>()
                .eqIfPresent(CommentDO::getTechnicianId, reqVO.getTechnicianId())
                .eqIfPresent(CommentDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(CommentDO::getHomeEconomicsScore, reqVO.getHomeEconomicsScore())
                .eqIfPresent(CommentDO::getHomeEconomicsContent, reqVO.getHomeEconomicsContent())
                .eqIfPresent(CommentDO::getTechnicianScore, reqVO.getTechnicianScore())
                .eqIfPresent(CommentDO::getStoreAttitude, reqVO.getStoreAttitude())
                .eqIfPresent(CommentDO::getTechnicianAttitude, reqVO.getTechnicianAttitude())
                .betweenIfPresent(CommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommentDO::getId));
    }

}
